home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12679 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: southwind.net!usenet
  2. From: uar@southwind.net (richard mross)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Settle a bet please
  5. Date: Mon, 01 Apr 1996 19:40:04 GMT
  6. Organization: SouthWind Internet Access, Inc.
  7. Message-ID: <4jpbgm$71v@opal.southwind.net>
  8. References: <4jfopb$o9n@news1.sympatico.ca>
  9. NNTP-Posting-Host: ict100.southwind.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Gisele Swinson <gisele.swinson@sympatico.ca> wrote:
  13.  
  14. >In C language, how do they calculate the length of an array.
  15.  
  16. >example
  17.  
  18. >To declare a string "My Name"
  19.  
  20. >is it char name[7] = "My Name"
  21. >or
  22. >is it chat Name[8] = "My Name"
  23.  
  24. >There is a battle in my class whether to include the NULL in the
  25. >array size. 
  26.  
  27. >I would appreciate any input you might have.
  28.  
  29. >Thanks
  30.  
  31. >Gisele
  32.  
  33. I believe that char Name[8] would be needed although char Name[] =
  34. {"..."} would be better. the [7] array does not have the space for the
  35. zero.  I dont really know but try this.
  36. char name[7] = {"my name"};
  37. int somehting = 0xaaaa;
  38. then printf("[%s]",name);
  39. and see if it sees a null terminator or if it grabs the int too, also
  40. check the .map file to see if the int really follows the array..
  41.  
  42.  
  43.  
  44.  
  45.